UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vezWCcbZzyyWt59cjrY+o7JniwVM+32QIY8AjhJlgeg=' 
WHERE 
  key_id = '5a4157816a29da4a08aef76510c49ded20cc5ae970a7f880073b759a0de0e943' 
  AND (
    token = 'vezWCcbZzyyWt59cjrY+o7JniwVM+32QIY8AjhJlgeg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045