UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dw5CdxYw90bwzZ4Cq4ZUNFgjLy6nuBYcW2J32pkB6f4=' 
WHERE 
  key_id = '1b808e1b505764669c836f9448cbaebccbd0ceb83fc106461034f1a400114d35' 
  AND (
    token = 'dw5CdxYw90bwzZ4Cq4ZUNFgjLy6nuBYcW2J32pkB6f4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031