UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hn3cCyqyjERNRzemq95USmwoYRrsfC/eHoo/6rh0TUg='
WHERE
key_id = 'b140b818d068ebf76787d03b3e45b263a0c0adf1aec104f4777c9b0ad26818f1'
AND (
token = 'hn3cCyqyjERNRzemq95USmwoYRrsfC/eHoo/6rh0TUg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)