UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ad+r7n7hU0hGAVrG4qbySstsHKwYeqDDl+hcoTLQCdw='
WHERE
key_id = 'ef7be01e8cadf5110048c90034ab303dbcb6171562038a68f7e5c78f59b3acc7'
AND (
token = 'ad+r7n7hU0hGAVrG4qbySstsHKwYeqDDl+hcoTLQCdw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)