UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1r42k44p3KKmYP+IYPbxMJt7uJCNlkU73S6b7AZFks4=' 
WHERE 
  key_id = '6de6dac9e118a222d7e6284274862b68794afb02ec1833db207afc700cacc2ee' 
  AND (
    token = '1r42k44p3KKmYP+IYPbxMJt7uJCNlkU73S6b7AZFks4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020