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