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