UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UAlpdbvjxxjLrT9nHobyXo3LSjt5R9th/ZLJveZCjIg=' 
WHERE 
  key_id = '668d798323dd322db4bbe7a78618dbff79e534fc892bb3e975b6f0a02860adf9' 
  AND (
    token = 'UAlpdbvjxxjLrT9nHobyXo3LSjt5R9th/ZLJveZCjIg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032