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