UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'e3Jv6ENKHkok79myVZqQFf6aVoUJ+xtMCYx0FH8NxzU=' 
WHERE 
  key_id = '0a6ab7dd13ec5d38ad2630f152efc86cf5875e08672f2890b35cbb7c812db1d4' 
  AND (
    token = 'e3Jv6ENKHkok79myVZqQFf6aVoUJ+xtMCYx0FH8NxzU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016