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

Query time 0.00031