UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GqTfo//sfo5KbZ0ZU2ZUXaNWzSzXwbDDM6RosCRhRFA=' 
WHERE 
  key_id = '3261599198e21941b1fc46e31295a94b3f452c544667d40386dbb0cd744874b2' 
  AND (
    token = 'GqTfo//sfo5KbZ0ZU2ZUXaNWzSzXwbDDM6RosCRhRFA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034