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