UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IUoJDMbh4waZFn/Mnsio+0fzEPredbWuZE3k9c2gxf4='
WHERE
key_id = 'e2a00017f6707bc591861a62f0b0c1d099f2064f2b1ea73f8bba23766a562537'
AND (
token = 'IUoJDMbh4waZFn/Mnsio+0fzEPredbWuZE3k9c2gxf4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)