UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'K5D+ZpPTEhextsZaQ/kERzgHvvpPURZAVoRKqSIoV3c='
WHERE
key_id = 'ee287ca83f12dc5ab15f9da93a155d8abd741c0896078f70070db146cee6e0c6'
AND (
token = 'K5D+ZpPTEhextsZaQ/kERzgHvvpPURZAVoRKqSIoV3c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)