UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qSd1A5RUyMrJ3p8ylPolLQKnFS2EP+uZQCH+PKUr+gk=' 
WHERE 
  key_id = '4229fb558bc06b4ade6ceb454b0d46756ac3b7955c128b50ceae39c83686f0b5' 
  AND (
    token = 'qSd1A5RUyMrJ3p8ylPolLQKnFS2EP+uZQCH+PKUr+gk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054