UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4LvCHtKkV4xajWiAITW0CkKqsvM9lvJAGLLPIuI6T1o='
WHERE
key_id = '4ff3654efcb27e6bc146ac549daed088a120b472c2d092bcd2983aeb5279758b'
AND (
token = '4LvCHtKkV4xajWiAITW0CkKqsvM9lvJAGLLPIuI6T1o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)