UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WReAhuLXAmkpGnCR7jYA0V2j0pcfv6xyyOhYyw8iWLY=' 
WHERE 
  key_id = '1b858abad3292133e4235a68caaf30412e50c2355324fd87b794486a122beb6c' 
  AND (
    token = 'WReAhuLXAmkpGnCR7jYA0V2j0pcfv6xyyOhYyw8iWLY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039