UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CQ2T5PnbBYOyRgsAnPng8c5risWCifmHYP58sInc678='
WHERE
key_id = 'dd8e9dc2ced4e44a658b70a357bf625c435f811df35b0c8bce16055d28cee65b'
AND (
token = 'CQ2T5PnbBYOyRgsAnPng8c5risWCifmHYP58sInc678='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)