UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MFEPHZ1T58e/P4qsHOeCDSvwHWzeq04O/WpaF6kIapg='
WHERE
key_id = 'f12ad6f98a8ffb567324798ee2cff00283739121b04e94b8c5f0b703522335ec'
AND (
token = 'MFEPHZ1T58e/P4qsHOeCDSvwHWzeq04O/WpaF6kIapg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)