UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IZ/91lGIIDdHMw05uy55BQdV+Wj5kTbwRHc42rM73zI='
WHERE
key_id = 'af5540346da2e373561175e7096a9d5ed6bff0218acad42ad54756c88a0d1934'
AND (
token = 'IZ/91lGIIDdHMw05uy55BQdV+Wj5kTbwRHc42rM73zI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)