UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'O0pvREqbiLndOW1FGrZASgsz13JZvFxepRe7pooxdb0='
WHERE
key_id = '3696b6decbe9884ea1a8ca33b71abaadf44a7c90331a5c8746d1579eab5975aa'
AND (
token = 'O0pvREqbiLndOW1FGrZASgsz13JZvFxepRe7pooxdb0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)