UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wVhW2Xa+Z9dqTSfqwtZ1PL9poMkRrKcRtIfotOWWyc0='
WHERE
key_id = 'd001a50fac3f3e6ad0bb8673544f1560d9eccf7df586defbf7d4c4d023c15b2d'
AND (
token = 'wVhW2Xa+Z9dqTSfqwtZ1PL9poMkRrKcRtIfotOWWyc0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)