UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fYzqs1s+aJadE1w7xyOYSgqLDtfioYf33RsGbB6MR3w='
WHERE
key_id = 'b092735b88f7b1934f3c392060d81c1bd4816fb394e528166d8f28c57fb73f67'
AND (
token = 'fYzqs1s+aJadE1w7xyOYSgqLDtfioYf33RsGbB6MR3w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)