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