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