UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dbaBSo0ew79tOTa1AYPPDjDRkPPpHqmEUQMqoS0cECE='
WHERE
key_id = '249d4bfee110368c08fe0daaef13cf30ee3ee3bd5829e4f509b1bf0cfbe2d50e'
AND (
token = 'dbaBSo0ew79tOTa1AYPPDjDRkPPpHqmEUQMqoS0cECE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)