UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'W5LAbAToIofURHjiQWJcl2z3/Ui3K2gk8Prwy0XfAmI='
WHERE
key_id = 'd797476de7adc35d8582466492c4ba39d3724c332046d79d34ece9c1ead80540'
AND (
token = 'W5LAbAToIofURHjiQWJcl2z3/Ui3K2gk8Prwy0XfAmI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)