UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cnZCZxgY1zW7Q3lti/ici6qQ2BKdtSf9HvclOi69sHw='
WHERE
key_id = 'e5bfb2091efeb8edc6c45ca82442ea6a7ecd7f585fa4aa14d51361268eafb092'
AND (
token = 'cnZCZxgY1zW7Q3lti/ici6qQ2BKdtSf9HvclOi69sHw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)