UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WjHjSEJo4JXFL9qnc3yWgcDaRjW/IuD5hNYQOgKeXgM='
WHERE
key_id = 'b9ae41781fa6a96c86d45f7df9fe258e2b11cb8bddcdb60e2d0ea59bc062262d'
AND (
token = 'WjHjSEJo4JXFL9qnc3yWgcDaRjW/IuD5hNYQOgKeXgM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)