UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NnXV/CHQjqE5+8eurujeLqFhLaaY1f0TfZEvhqyfdAE=' 
WHERE 
  key_id = 'b58f4feecab165a64f287b97445f193a7c880d46afe53b096006e8d8b2ef32a4' 
  AND (
    token = 'NnXV/CHQjqE5+8eurujeLqFhLaaY1f0TfZEvhqyfdAE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035