UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hyDqhdCvFj0josH1PUMawO4BG5GUhz7uNFFdRz27CaE='
WHERE
key_id = '51a845c520c411c951b3a5cc201f0ac24ede0b604d420e7b32b43efe3242d03c'
AND (
token = 'hyDqhdCvFj0josH1PUMawO4BG5GUhz7uNFFdRz27CaE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)