UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'y4zWhauWl4QvI418eiKjqHkRuKfvIReDOyahVe8EcXU='
WHERE
key_id = '2ae208f90774750391d71d60266b6ba008512bd027b5660de0b5911d27ac737a'
AND (
token = 'y4zWhauWl4QvI418eiKjqHkRuKfvIReDOyahVe8EcXU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)