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