UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'M114iDPycrNjzGjAwavvOhjLGnYs/sFpwauADj+bt8E='
WHERE
key_id = 'a7a51b8097f95a8ff3ea966e4d57678842495d46e583c410b39289d3fa2fe682'
AND (
token = 'M114iDPycrNjzGjAwavvOhjLGnYs/sFpwauADj+bt8E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)