UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'd31UoHUJ+CMk95TJsQm7xMPx7/LFeepmg44kRKpFHyQ=' 
WHERE 
  key_id = '258c43acf8a0b3fee7115e7ebb24756ff93451d7a384baf17d6f876c30066766' 
  AND (
    token = 'd31UoHUJ+CMk95TJsQm7xMPx7/LFeepmg44kRKpFHyQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035