UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uYvcmIlY3Dbr7wa9VV3JilY4xy1co07ZcJdX9i1kJ4w='
WHERE
key_id = 'f62d984623aa757c4758e1a1639df9b3befa306b69a08c17148f2ed713049264'
AND (
token = 'uYvcmIlY3Dbr7wa9VV3JilY4xy1co07ZcJdX9i1kJ4w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)