UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ihS9vrUzNq4C4xVlhsQsiww6tOjMirkyIy7aJPfd7/A='
WHERE
key_id = 'a6238b73506f58db3e0a477639466d17b00d75e2ca0c77fc6e3e44f6b4e8cb83'
AND (
token = 'ihS9vrUzNq4C4xVlhsQsiww6tOjMirkyIy7aJPfd7/A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)