UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ev2Tc/2zIZunbuTOnPnS8wRs6Ze8o9ZyFEwmV9o8Nw0='
WHERE
key_id = '12e72c64430a63a069efae64a381244c51ccf1b082af94b2f1fc52028e3dc481'
AND (
token = 'Ev2Tc/2zIZunbuTOnPnS8wRs6Ze8o9ZyFEwmV9o8Nw0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)