UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'd6953j/w3dcDYohIlWii+UIE810GJMRy0U/Zngc1Uxc='
WHERE
key_id = 'a587848de8bc17d7c3903a796ebffb879ab3bc41480a7db0d1075e8c6e7ebf4a'
AND (
token = 'd6953j/w3dcDYohIlWii+UIE810GJMRy0U/Zngc1Uxc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)